package com.kim.useroauth.server.controller;

import com.kim.common.utilcom.model.Result;
import com.kim.oauth.common.model.UserAccount;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Project: kim-security-oauth
 * @PackageName: com.kim.useroauth.server.controller
 * @FileName: KimController.java
 * @Description: The KimController is...
 * @Author: kimwu
 * @Time: 2020-12-09 15:55:35
 */
@RestController
@RequestMapping("/kimAu")
@Slf4j
public class KimController {

    @PostMapping("/et")
    public Result et() {
        UserAccount principal = (UserAccount) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        log.info("当前登陆用户 -- > {}", principal);
        return Result.succeed(principal);
    }
}
